package com.laicar.section49;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.text.Html;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        TextView txtView = findViewById(R.id.txtView);
        String name = getColoredSpanned("Hiren","#800000");
        String surName = getColoredSpanned("Patel","#000080");
        txtView.setText(Html.fromHtml(name+" " + surName));
    }

    private String getColoredSpanned(String text,String color){
        String input = "<font color="+color+">" +text + "</font>";
        return input;
    }


}
